import Request from '@/libs/service/index';

import type {IResult,IListResult } from './type';
import { BASE_URL } from '../../request/config';
import { ICategoryForm } from '@/libs/type/category';

enum LoginAPI {
    CategoryList = '/category/list',
    CategoryAdd = '/category/add',
    CategoryUpdate = '/category/update',
    CategoryRemove = '/category/remove',
}

export function CategoryListRequest(obj: ICategoryForm) {
    return Request.post<IListResult>({
        url: BASE_URL + LoginAPI.CategoryList,
        data: obj,
    });
}

export function CategoryAddRequest(obj: ICategoryForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.CategoryAdd,
        data: obj,
    });
}

export function CategoryUpdateRequest(obj: ICategoryForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.CategoryUpdate,
        data: obj,
    });
}

export function CategoryRemoveRequest(obj: ICategoryForm) {
    return Request.post<IResult>({
        url: BASE_URL + LoginAPI.CategoryRemove,
        data: obj,
    });
}